package edu.ucla.wanda.social;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ApplicationScoped;
import java.io.*;

import edu.ucla.wanda.social.AuthStep;

import java.net.URLEncoder;


@ManagedBean
@ApplicationScoped
public class FacebookAuthFlow {
	private AuthStep[] steps = new AuthStep[] {
			new AuthStep("1. Authorize Facebook access", "The first step is to grant the necessary privileges to the Facebook application.  Please click 'Register' on the prompt below."),
			new AuthStep("2. Connect with study database", "Now you need to provide your study login information.  Your group administrator must provide you with this information."),
			new AuthStep("3. Join Facebook group for study", "TODO."),
			new AuthStep("4. Set up preferences", "TODO.")};
	
	private String facebookRedirectURL;
	private String facebookAuthURL = "https://www.facebook.com/dialog/oauth?client_id=321155711249351&scope=email,read_stream&redirect_uri=";
	
	public FacebookAuthFlow() throws UnsupportedEncodingException {
		 facebookRedirectURL = URLEncoder.encode("http://localhost:8080/AWSTest/FbAuth/", "UTF-8");
	}
	
	public AuthStep[] getSteps() {
		return steps;
	}
	
	public String getStyle(int step, int currentStep) {
		if (currentStep > step) return "completedFont";
		if (currentStep < step) return "incompleteFont";
		return "currentFont";		
	}	
}